{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensorflow2.0_course  tf1.13的简单操作.ipynb  tf_requirements.txt\r\n",
      "test\t\t      tf2.ipynb\t\t      练习版本差异1.13.ipynb\r\n"
     ]
    }
   ],
   "source": [
    "!ls"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "outputs": [
    {
     "data": {
      "text/plain": "0.2222222222222222"
     },
     "metadata": {},
     "output_type": "execute_result",
     "execution_count": 10
    }
   ],
   "source": [
    "np.var([2,1,1])"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n",
     "is_executing": false
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [
    {
     "data": {
      "text/plain": "{3}"
     },
     "metadata": {},
     "output_type": "execute_result",
     "execution_count": 2
    }
   ],
   "source": [
    "set([1,2,3])-set([1,2])"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n",
     "is_executing": false
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "outputs": [
    {
     "data": {
      "text/plain": "-0.9182958340544896"
     },
     "metadata": {},
     "output_type": "execute_result",
     "execution_count": 9
    }
   ],
   "source": [
    "1/3*np.log2(1/3)+2/3*np.log2(2/3)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n",
     "is_executing": false
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "outputs": [
    {
     "data": {
      "text/plain": "0.0"
     },
     "metadata": {},
     "output_type": "execute_result",
     "execution_count": 10
    }
   ],
   "source": [
    "1*np.log2(1)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n",
     "is_executing": false
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "outputs": [
    {
     "data": {
      "text/plain": "array([[[ 0,  1,  2],\n        [ 3,  4,  5],\n        [ 6,  7,  8]],\n\n       [[ 9, 10, 11],\n        [12, 13, 14],\n        [15, 16, 17]],\n\n       [[18, 19, 20],\n        [21, 22, 23],\n        [24, 25, 26]]])"
     },
     "metadata": {},
     "output_type": "execute_result",
     "execution_count": 13
    }
   ],
   "source": [
    "a=np.array(range(27)).reshape(3,3,3)\n",
    "a"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n",
     "is_executing": false
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "outputs": [
    {
     "data": {
      "text/plain": "array([[ 0],\n       [ 1],\n       [ 2],\n       [ 3],\n       [ 4],\n       [ 5],\n       [ 6],\n       [ 7],\n       [ 8],\n       [ 9],\n       [10],\n       [11],\n       [12],\n       [13],\n       [14],\n       [15],\n       [16],\n       [17],\n       [18],\n       [19],\n       [20],\n       [21],\n       [22],\n       [23],\n       [24],\n       [25],\n       [26]])"
     },
     "metadata": {},
     "output_type": "execute_result",
     "execution_count": 14
    }
   ],
   "source": [
    "a.reshape(-1,1)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n",
     "is_executing": false
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "outputs": [
    {
     "ename": "OutOfBoundsDatetime",
     "evalue": "Out of bounds nanosecond timestamp: 1492-08-01 05:58:27",
     "output_type": "error",
     "traceback": [
      "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[1;31mTypeError\u001B[0m                                 Traceback (most recent call last)",
      "File \u001B[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\pandas\\core\\arrays\\datetimes.py:2211\u001B[0m, in \u001B[0;36mobjects_to_datetime64ns\u001B[1;34m(data, dayfirst, yearfirst, utc, errors, require_iso8601, allow_object, allow_mixed)\u001B[0m\n\u001B[0;32m   2210\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m-> 2211\u001B[0m     values, tz_parsed \u001B[38;5;241m=\u001B[39m \u001B[43mconversion\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mdatetime_to_datetime64\u001B[49m\u001B[43m(\u001B[49m\u001B[43mdata\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mravel\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mK\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m   2212\u001B[0m     \u001B[38;5;66;03m# If tzaware, these values represent unix timestamps, so we\u001B[39;00m\n\u001B[0;32m   2213\u001B[0m     \u001B[38;5;66;03m#  return them as i8 to distinguish from wall times\u001B[39;00m\n",
      "File \u001B[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\pandas\\_libs\\tslibs\\conversion.pyx:360\u001B[0m, in \u001B[0;36mpandas._libs.tslibs.conversion.datetime_to_datetime64\u001B[1;34m()\u001B[0m\n",
      "\u001B[1;31mTypeError\u001B[0m: Unrecognized value type: <class 'str'>",
      "\nDuring handling of the above exception, another exception occurred:\n",
      "\u001B[1;31mOutOfBoundsDatetime\u001B[0m                       Traceback (most recent call last)",
      "Input \u001B[1;32mIn [8]\u001B[0m, in \u001B[0;36m<cell line: 4>\u001B[1;34m()\u001B[0m\n\u001B[0;32m      1\u001B[0m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;21;01mpandas\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m \u001B[38;5;21;01mpd\u001B[39;00m\n\u001B[0;32m      3\u001B[0m a\u001B[38;5;241m=\u001B[39mpd\u001B[38;5;241m.\u001B[39mDataFrame([\u001B[38;5;124m'\u001B[39m\u001B[38;5;124m1492-08-01 05:58:27\u001B[39m\u001B[38;5;124m'\u001B[39m])\n\u001B[1;32m----> 4\u001B[0m \u001B[43mpd\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mto_datetime\u001B[49m\u001B[43m(\u001B[49m\u001B[43ma\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;241;43m0\u001B[39;49m\u001B[43m]\u001B[49m\u001B[43m)\u001B[49m\n",
      "File \u001B[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\pandas\\core\\tools\\datetimes.py:1051\u001B[0m, in \u001B[0;36mto_datetime\u001B[1;34m(arg, errors, dayfirst, yearfirst, utc, format, exact, unit, infer_datetime_format, origin, cache)\u001B[0m\n\u001B[0;32m   1049\u001B[0m         result \u001B[38;5;241m=\u001B[39m arg\u001B[38;5;241m.\u001B[39mmap(cache_array)\n\u001B[0;32m   1050\u001B[0m     \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[1;32m-> 1051\u001B[0m         values \u001B[38;5;241m=\u001B[39m \u001B[43mconvert_listlike\u001B[49m\u001B[43m(\u001B[49m\u001B[43marg\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_values\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43mformat\u001B[39;49m\u001B[43m)\u001B[49m\n\u001B[0;32m   1052\u001B[0m         result \u001B[38;5;241m=\u001B[39m arg\u001B[38;5;241m.\u001B[39m_constructor(values, index\u001B[38;5;241m=\u001B[39marg\u001B[38;5;241m.\u001B[39mindex, name\u001B[38;5;241m=\u001B[39marg\u001B[38;5;241m.\u001B[39mname)\n\u001B[0;32m   1053\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m \u001B[38;5;28misinstance\u001B[39m(arg, (ABCDataFrame, abc\u001B[38;5;241m.\u001B[39mMutableMapping)):\n",
      "File \u001B[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\pandas\\core\\tools\\datetimes.py:402\u001B[0m, in \u001B[0;36m_convert_listlike_datetimes\u001B[1;34m(arg, format, name, tz, unit, errors, infer_datetime_format, dayfirst, yearfirst, exact)\u001B[0m\n\u001B[0;32m    400\u001B[0m \u001B[38;5;28;01massert\u001B[39;00m \u001B[38;5;28mformat\u001B[39m \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m \u001B[38;5;129;01mor\u001B[39;00m infer_datetime_format\n\u001B[0;32m    401\u001B[0m utc \u001B[38;5;241m=\u001B[39m tz \u001B[38;5;241m==\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mutc\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m--> 402\u001B[0m result, tz_parsed \u001B[38;5;241m=\u001B[39m \u001B[43mobjects_to_datetime64ns\u001B[49m\u001B[43m(\u001B[49m\n\u001B[0;32m    403\u001B[0m \u001B[43m    \u001B[49m\u001B[43marg\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    404\u001B[0m \u001B[43m    \u001B[49m\u001B[43mdayfirst\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mdayfirst\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    405\u001B[0m \u001B[43m    \u001B[49m\u001B[43myearfirst\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43myearfirst\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    406\u001B[0m \u001B[43m    \u001B[49m\u001B[43mutc\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mutc\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    407\u001B[0m \u001B[43m    \u001B[49m\u001B[43merrors\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43merrors\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    408\u001B[0m \u001B[43m    \u001B[49m\u001B[43mrequire_iso8601\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mrequire_iso8601\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    409\u001B[0m \u001B[43m    \u001B[49m\u001B[43mallow_object\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43;01mTrue\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[0;32m    410\u001B[0m \u001B[43m\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m    412\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m tz_parsed \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[0;32m    413\u001B[0m     \u001B[38;5;66;03m# We can take a shortcut since the datetime64 numpy array\u001B[39;00m\n\u001B[0;32m    414\u001B[0m     \u001B[38;5;66;03m# is in UTC\u001B[39;00m\n\u001B[0;32m    415\u001B[0m     dta \u001B[38;5;241m=\u001B[39m DatetimeArray(result, dtype\u001B[38;5;241m=\u001B[39mtz_to_dtype(tz_parsed))\n",
      "File \u001B[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\pandas\\core\\arrays\\datetimes.py:2217\u001B[0m, in \u001B[0;36mobjects_to_datetime64ns\u001B[1;34m(data, dayfirst, yearfirst, utc, errors, require_iso8601, allow_object, allow_mixed)\u001B[0m\n\u001B[0;32m   2215\u001B[0m         \u001B[38;5;28;01mreturn\u001B[39;00m values\u001B[38;5;241m.\u001B[39mview(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mi8\u001B[39m\u001B[38;5;124m\"\u001B[39m), tz_parsed\n\u001B[0;32m   2216\u001B[0m     \u001B[38;5;28;01mexcept\u001B[39;00m (\u001B[38;5;167;01mValueError\u001B[39;00m, \u001B[38;5;167;01mTypeError\u001B[39;00m):\n\u001B[1;32m-> 2217\u001B[0m         \u001B[38;5;28;01mraise\u001B[39;00m err\n\u001B[0;32m   2219\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m tz_parsed \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[0;32m   2220\u001B[0m     \u001B[38;5;66;03m# We can take a shortcut since the datetime64 numpy array\u001B[39;00m\n\u001B[0;32m   2221\u001B[0m     \u001B[38;5;66;03m#  is in UTC\u001B[39;00m\n\u001B[0;32m   2222\u001B[0m     \u001B[38;5;66;03m# Return i8 values to denote unix timestamps\u001B[39;00m\n\u001B[0;32m   2223\u001B[0m     \u001B[38;5;28;01mreturn\u001B[39;00m result\u001B[38;5;241m.\u001B[39mview(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mi8\u001B[39m\u001B[38;5;124m\"\u001B[39m), tz_parsed\n",
      "File \u001B[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\pandas\\core\\arrays\\datetimes.py:2199\u001B[0m, in \u001B[0;36mobjects_to_datetime64ns\u001B[1;34m(data, dayfirst, yearfirst, utc, errors, require_iso8601, allow_object, allow_mixed)\u001B[0m\n\u001B[0;32m   2197\u001B[0m order: Literal[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mF\u001B[39m\u001B[38;5;124m\"\u001B[39m, \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mC\u001B[39m\u001B[38;5;124m\"\u001B[39m] \u001B[38;5;241m=\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mF\u001B[39m\u001B[38;5;124m\"\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m flags\u001B[38;5;241m.\u001B[39mf_contiguous \u001B[38;5;28;01melse\u001B[39;00m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mC\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[0;32m   2198\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m-> 2199\u001B[0m     result, tz_parsed \u001B[38;5;241m=\u001B[39m \u001B[43mtslib\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43marray_to_datetime\u001B[49m\u001B[43m(\u001B[49m\n\u001B[0;32m   2200\u001B[0m \u001B[43m        \u001B[49m\u001B[43mdata\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mravel\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mK\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m   2201\u001B[0m \u001B[43m        \u001B[49m\u001B[43merrors\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43merrors\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m   2202\u001B[0m \u001B[43m        \u001B[49m\u001B[43mutc\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mutc\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m   2203\u001B[0m \u001B[43m        \u001B[49m\u001B[43mdayfirst\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mdayfirst\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m   2204\u001B[0m \u001B[43m        \u001B[49m\u001B[43myearfirst\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43myearfirst\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m   2205\u001B[0m \u001B[43m        \u001B[49m\u001B[43mrequire_iso8601\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mrequire_iso8601\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m   2206\u001B[0m \u001B[43m        \u001B[49m\u001B[43mallow_mixed\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mallow_mixed\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m   2207\u001B[0m \u001B[43m    \u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m   2208\u001B[0m     result \u001B[38;5;241m=\u001B[39m result\u001B[38;5;241m.\u001B[39mreshape(data\u001B[38;5;241m.\u001B[39mshape, order\u001B[38;5;241m=\u001B[39morder)\n\u001B[0;32m   2209\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mValueError\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m err:\n",
      "File \u001B[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\pandas\\_libs\\tslib.pyx:381\u001B[0m, in \u001B[0;36mpandas._libs.tslib.array_to_datetime\u001B[1;34m()\u001B[0m\n",
      "File \u001B[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\pandas\\_libs\\tslib.pyx:608\u001B[0m, in \u001B[0;36mpandas._libs.tslib.array_to_datetime\u001B[1;34m()\u001B[0m\n",
      "File \u001B[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\pandas\\_libs\\tslib.pyx:604\u001B[0m, in \u001B[0;36mpandas._libs.tslib.array_to_datetime\u001B[1;34m()\u001B[0m\n",
      "File \u001B[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\pandas\\_libs\\tslib.pyx:580\u001B[0m, in \u001B[0;36mpandas._libs.tslib.array_to_datetime\u001B[1;34m()\u001B[0m\n",
      "File \u001B[1;32m~\\AppData\\Roaming\\Python\\Python39\\site-packages\\pandas\\_libs\\tslibs\\np_datetime.pyx:120\u001B[0m, in \u001B[0;36mpandas._libs.tslibs.np_datetime.check_dts_bounds\u001B[1;34m()\u001B[0m\n",
      "\u001B[1;31mOutOfBoundsDatetime\u001B[0m: Out of bounds nanosecond timestamp: 1492-08-01 05:58:27"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "a=pd.DataFrame(['1492-08-01 05:58:27'])\n",
    "pd.to_datetime(a[0])"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "name": "python3",
   "language": "python",
   "display_name": "Python 3 (ipykernel)"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}